package com.xj.config;

import com.xj.bean.Person;
import com.xj.service.BookService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Controller;

/**
 * 组件注册
 * @author xujiang
 * @date 2021/1/13 22:02
 */
@ComponentScan(value = "com.xj", includeFilters = {// 只包含
//        @ComponentScan.Filter(type = FilterType.ANNOTATION,//根据注解扫描
//                classes = {Controller.class}),
//        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,//按照给定的类型
//                classes = {BookService.class}),
        @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})//自定义过滤器

},
       
        useDefaultFilters = false)
@Configuration
public class MainConfig {

    @Bean("person")
    public Person person01() {
        return new Person("zhangsan", 20);
    }
}
